package net.luohuasheng.bee.proxy.mybatis.executor.page;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Pageable {
    private boolean counting = true;
    private int page;
    private int row;
    private List<Order> orders = new ArrayList<>();


    public Pageable(int page, int row, Order[] orders) {
        this.page = page;
        this.row = row;
        if (orders != null) {
            Collections.addAll(this.orders, orders);
        }
    }

    public Pageable(int page, int row, boolean counting, Order[] orders) {
        this.page = page;
        this.row = row;
        this.counting = counting;
        if (orders != null) {
            Collections.addAll(this.orders, orders);
        }
    }


    public static Pageable of(int page, int row, Order... orders) {
        return new Pageable(page, row, orders);
    }

    public static Pageable ofnc(int page, int row, Order... orders) {
        return new Pageable(page, row, false, orders);
    }

    public int getPage() {
        return page;
    }


    public int getRow() {
        return row;
    }


    public List<Order> getOrders() {
        return orders;
    }


    public boolean isCounting() {
        return counting;
    }
}
